import request from "@/utils/request";

// 验证 code 是否正确
export function checkCode(secretKey: string, code: string) {
  return request({
    url: `/user/google/checkCode/${secretKey}/${code}`,
    method: "get",
  });
}

// 获取code
export function getCode(secretKey: string) {
  return request({
    url: `/user/google/getCode/${secretKey}`,
    method: "get",
  });
}

// 生成二维码转base64Pic
export function getQrCode(secretKey: string) {
  return request({
    url: `/user/google/getQrCode/${secretKey}`,
    method: "get",
  });
}

// 生成 Google 密钥，两种方式任选一种
export function getSecretKey() {
  return request({
    url: `/user/google/getSecretKey`,
    method: "get",
  });
}

// 绑定谷歌
export function googleBind(data: object) {
  return request({
    url: "/user/google/googleBind",
    method: "post",
    data,
  });
}

// 解绑谷歌
export function googleUnBind(data: object) {
  return request({
    url: "/user/google/googleUnBind",
    method: "post",
    data,
  });
}